package com.edais.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.edais.domain.Loan;
import com.edais.domain.Scattered;
import com.edais.persistence.LoanMapper;
import com.edais.vo.LoanVo;

@Repository

public class LoanDao {
	@Autowired
	private LoanMapper loanMapper;

	/**
	 * 散标基本信息
	 * @param map
	 * @return
	 */
	public List<LoanVo> getLoanList(Map<String,Object> map) throws Exception{
		return loanMapper.getLoanList(map);
	}

	public int getLoanListSize(Map<String,Object> map) throws Exception{
		return loanMapper.getLoanListSize(map);
	}
	
	public List getPlanByMain(Map<String,Object> map) throws Exception{
		return loanMapper.getPlanByMain(map);
	}
	
	/**
	 * 散标详细信息
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Map getLoanDetail(Map<String,Object> map) throws Exception{
		return loanMapper.getLoanDetail(map);
	}
	
	/**
	 * 散标详细信息
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Loan getLoanDetailByFinaceId(Map<String,Object> map) throws Exception{
		return (Loan) loanMapper.getLoanDetailByFinaceId(map);
	}
	
	/**
	 * 借款人信息
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Map getBorrowerInfo(Map<String,Object> map) throws Exception{
		return loanMapper.getBorrowerInfo(map);
	}
	
	/**
	 * 查询所有上架表产品信息
	 * @param map
	 * @return
	 */
	public List<Scattered> queryScatteredLoan(Map<String, Object> map) throws Exception{
		return loanMapper.queryScatteredLoan(map);
	}
	/**
	 * 查询所有上架表产品信息
	 * @param map
	 * @return
	 */
	public List<Scattered> queryScatteredLoanInfo(Map<String, Object> map) throws Exception{
		return loanMapper.queryScatteredLoanInfo(map);
	}
	/**
	 * 查询所有上架表产品信息总数
	 * @return
	 */
	public String queryScatteredLoanCount(Map<String,Object> map) throws Exception{
		return loanMapper.queryScatteredLoanCount(map);
	}
	/**
	 * 查询所有上架表产品信息总数
	 * @return
	 */
	public Integer queryScatteredLoanInfoCount(Map<String,Object> map) throws Exception{
		return loanMapper.queryScatteredLoanInfoCount(map);
	}
	
	public List getLenderMaterials(Map<String,Object> map) throws Exception{
		return loanMapper.getLenderMaterials(map);
	}
	
	/**
	 * 散标详细信息
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Loan getLoanDetailByLoanId(Map<String,Object> map) throws Exception{
		return (Loan) loanMapper.getLoanDetailByLoanId(map);
	}
	
	/**
	 * 散标详细信息通过上架表ID
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Loan getLoanDetailBySLoanId(Map<String,Object> map) throws Exception{
		return (Loan) loanMapper.getLoanDetailBySLoanId(map);
	}
	
	
	public List<Scattered> queryWxAndAppLoan() throws Exception{
		return loanMapper.queryWxAndAppLoan();
	}
	
	public String queryBitShowNamePeriod(){
		return loanMapper.queryBitShowNamePeriod();
	}
	
	public String queryBitShowNameCurrent(){
		return loanMapper.queryBitShowNameCurrent();
	}
	/**
	 * 根据加息券ID的借款期数查询上架表
	 * @param paramsMap
	 * @return
	 */
	public List<Scattered> queryScatteredByRateId(Map<String,Object> paramsMap){
		return this.loanMapper.queryScatteredByRateId(paramsMap);
	}
	
	/**
	 * 根据上架散标ID查询散标信息
	 * @param paramsMap
	 * @return
	 */
	public Scattered queryScatteredByLoanId(Map<String,Object> paramsMap){
		return this.loanMapper.queryScatteredByLoanId(paramsMap);
	}

	/**
	 * 根据上架散标表ID查询散标计息日
	 * @param paramsMap
	 * @return
	 */
	public Integer queryScatteredLoanValueDateById(Map<String,Object> paramsMap){
		return this.loanMapper.queryScatteredLoanValueDateById(paramsMap);
	}
	
	/**
	 * 根据代金券ID查询符合的散标信息
	 * @param paramsMap
	 * @return
	 */
	public List<Scattered> queryScatteredByVouchersId(Map<String,Object> paramsMap){
		return this.loanMapper.queryScatteredByVouchersId(paramsMap);
	}

	public String getFinishedRatio(String sloanId) throws Exception{
		// TODO Auto-generated method stub
		return loanMapper.getFinishedRatio(sloanId);
	}
	
}
